package com.example.wyz.classplus.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.wyz.classplus.R;
import com.example.wyz.classplus.base.BaseFragment;
import com.example.wyz.classplus.contract.fgm.PrivateNoticeListContract;
import com.example.wyz.classplus.presenter.PrivateNoticeListPresenter;
import com.example.wyz.classplus.ui.adapter.PrivateNoticeListAdapter;

import butterknife.BindView;

/**
 * Created by 10153 on 2017/5/29.
 */

public class PrivateNoticeListFragment extends BaseFragment<PrivateNoticeListContract.Presenter>
        implements PrivateNoticeListContract.View{

    @BindView(R.id.rec_msg_notice) RecyclerView mPrivateNotice;

    private PrivateNoticeListAdapter adapter;

    //BaseFragment方法重写&接口实现

    @Nullable @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        initRecyclerView();
        return view;
    }

    @Override
    protected void initPresenter() {
        mPresenter = new PrivateNoticeListPresenter(this.mContext, this);
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_notice;
    }

    //contract.view接口实现

    //私有方法

    private void initRecyclerView(){
        adapter = new PrivateNoticeListAdapter(this.mContext);
        mPrivateNotice.setLayoutManager(new LinearLayoutManager(this.mContext));
        mPrivateNotice.setAdapter(adapter);
    }
}
